//
//  AddSideTableViewCell.m
//  fitnessmanage
//
//  Created by wujian on 2017/12/18.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "AddSideTableViewCell.h"

@implementation AddSideTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        CommonInputView *nameInputView = [[CommonInputView alloc] init];
        nameInputView.titleTF.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:nameInputView];
        self.nameInputView = nameInputView;
        
        [self setConstraints];
    }
    
    return self;
}

-(void)setConstraints{
    
    [self.nameInputView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.edges.mas_equalTo(self.contentView);
    }];
}
@end


@implementation AddSideTableViewCellCustom

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.backgroundColor = CSWhiteColor;
        
        UILabel *titleLabel = [[UILabel alloc] init];
        //titleLabel.text = @"地址*";
        titleLabel.font = MidBigFont;
        titleLabel.textColor = CSColorFromRGB(0x666666);
        [self.contentView addSubview:titleLabel];
        self.titleLabel = titleLabel;
        
        /**
         场馆地址
         */
        UITextField *titleTF = [[UITextField alloc] init];
        UIView *addrLeftView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 15)];
        titleTF.userInteractionEnabled = NO;
        titleTF.leftView = addrLeftView1;
        titleTF.font = MidBigFont;
        titleTF.textColor = TFColor;        
        titleTF.leftViewMode = UITextFieldViewModeAlways;
        titleTF.clearButtonMode=UITextFieldViewModeWhileEditing;
        titleTF.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:titleTF];
        self.titleTF = titleTF;;
        
        
        UILabel *unitLabel = [[UILabel alloc] init];
        //titleLabel.text = @"地址*";
        unitLabel.font = MidBigFont;
        unitLabel.textColor = CSColorFromRGB(0x666666);
        [self.contentView addSubview:unitLabel];
        self.unitLabel = unitLabel;
        
        
        UIView *lineView= [[UIView alloc] init];
        lineView.backgroundColor = CSColorFromRGB(0xe6e6e6);
        [self.contentView addSubview:lineView];
        self.lineView = lineView;;
        
        /**
         上移
         */
        UIButton *upBtn = [[UIButton alloc] init];
        [upBtn setImage:@"icon_pup_light"];
        [upBtn setImage:[UIImage imageNamed:@"icon_pup"] forState:UIControlStateDisabled];
        [self.contentView addSubview:upBtn];
        self.upBtn = upBtn;
        
        
        /**
         清除
         */
        UIButton *clearBtn = [[UIButton alloc] init];
        [clearBtn setImage:@"icon_pclose_light"];
        [clearBtn setImage:[UIImage imageNamed:@"icon_pclose"] forState:UIControlStateDisabled];
        [self.contentView addSubview:clearBtn];
        self.clearBtn = clearBtn;

        [self setConstraints];
    }
    
    return self;
}

-(void)setConstraints{
    
    [self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(self.titleTF);
        
        make.left.mas_equalTo(self.contentView).offset(10);
        
        make.width.mas_equalTo(100);
    }];
    
    
    [self.titleTF mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.bottom.mas_equalTo(self.contentView);
        
        make.width.mas_equalTo(40);
        
        make.left.mas_equalTo(self.titleLabel.mas_right);
        
        make.height.mas_equalTo(60);
    }];
    
    [self.unitLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.mas_equalTo(self.contentView);
        
        make.left.mas_equalTo(self.titleTF.mas_right);
    }];
    
    [self.lineView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.mas_equalTo(self.contentView);
        
        make.left.mas_equalTo(self.contentView).offset(10);
        
        make.right.mas_equalTo(self.contentView);
        
        make.height.mas_equalTo(1);
    }];
    
    /**
     上移
     */
    [self.upBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.mas_equalTo(self.contentView);
        
        make.right.mas_equalTo(self.clearBtn.mas_left).offset(-10);
    }];
    
    
    /**
     清除
     */
    [self.clearBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.mas_equalTo(self.contentView);
        
        make.right.mas_equalTo(self.contentView).offset(-20);
    }];
}

@end
